<?php

/**
 * Images form base class.
 *
 * @method Images getObject() Returns the current form's model object
 *
 * @package    PHOTO_GALLERY
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseImagesForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'image_id'       => new sfWidgetFormInputHidden(),
      'name'           => new sfWidgetFormInputText(),
      'album_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Albums'), 'add_empty' => false)),
      'price'          => new sfWidgetFormInputText(),
      'no_of_rates'    => new sfWidgetFormInputText(),
      'avg_rate'       => new sfWidgetFormInputText(),
      'order_in_album' => new sfWidgetFormInputText(),
      'added_at'       => new sfWidgetFormDateTime(),
      'size'           => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'image_id'       => new sfValidatorChoice(array('choices' => array($this->getObject()->get('image_id')), 'empty_value' => $this->getObject()->get('image_id'), 'required' => false)),
      'name'           => new sfValidatorString(array('max_length' => 30)),
      'album_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Albums'))),
      'price'          => new sfValidatorNumber(),
      'no_of_rates'    => new sfValidatorInteger(array('required' => false)),
      'avg_rate'       => new sfValidatorNumber(array('required' => false)),
      'order_in_album' => new sfValidatorInteger(array('required' => false)),
      'added_at'       => new sfValidatorDateTime(),
      'size'           => new sfValidatorNumber(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('images[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Images';
  }

}
